<template>
<span class="op_dir_cache_models-wrapper">
  <button v-if="btns.to_clear" title="清除指定模型缓存"
          class="ui circular icon primary button tiny"
          @click.stop.prevent="to_clear()">
          <i class="icon icon-qingchu"></i>
        </button>

    <confirm_tpl @set_html="set_html">
        <div class="ui centered form">
            <div class="ui header">清除模型缓存</div>
                <div class="field">
                    <label for="">模型名</label>
                    <input type="text" id="c_model" v-focus placeholder="请输入需要清除的模型">
                </div>
        </div>
    </confirm_tpl>
</span>

</template>



<script type="text/ecmascript-6">
  import tool from 'src/util/tool';
  import util from '_util/index';
  import logic from '_logic';
  import in_array from 'in_array';

  import btn_group from 'components/common/btn_group';
  import confirm_tpl from 'components/pop/confirm_tpl';


  export default {
    data() {
      return {
          tpl:''
      }
    },
    components: {
        confirm_tpl
    },
    methods: {
        set_html(tpl){
            this.tpl = tpl;
      },
      to_clear(){

          util.showDiyConfirm(this, () => {
              let model = $('#c_model').val();
              let url = tool.getApi(this, 'Post', 'clearCache');
              util.http.SR(this, url,{model}, '操作成功!');
          }, this.tpl);

      },
    },
    computed: {
      ctl(){
        return this.$route.query.ctl;
      },
      is_admin(){
        return util.is_admin(this);
      },
    },
    props: ['btns'],
    created() {
    },
  };
</script>
<style rel="stylesheet/less" lang="less">@dir: "header/";</style>
